﻿#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include "SList.h"
#include "contact.h"

void menu() {
	printf("**************************************\n");
	printf("**********       通讯录      *********\n");
	printf("******  1.添加用户   2.删除用户 ******\n");
	printf("******  3.查找用户   4.修改用户 ******\n");
	printf("******  5.展示用户   6.排序    *******\n");
	printf("**********     0.退出     ************\n");
	printf("**************************************\n");
	printf("请选择您的操作：\n");
}

void text()
{
	int input = 0;
	contact con;
	InitContact(&con);
	do
	{
		menu();
		scanf("%d", &input);
		switch (input)
		{
		case 1:
			AddContact(&con);
			break;
		case 2:
			DelContact(&con);
			break;
		case 3:
			FindContact(&con);
			break;
		case 4:
			ModifyContact(&con);
			break;
		case 5:
			ShowContact(&con);
			break;
		//case 6:
			//SortContact(&con);
			//break;
		case 0:
			DestroyContact(&con);
			printf("已成功退出！\n");
			break;
		default:
			printf("请输入正确的选项！\n");
		}
	} while (input);
	
}

int main()
{
	text();
	return 0;
}